<template>
  <div class="page-fs">
    <el-upload
      class="upload-main"
      action="https://jsonplaceholder.typicode.com/posts/"
      :on-change="handleChange"
      :file-list="fileList"
      :drag="dragTag"
      :multiple="multipleTag"
    >
      <i class="el-icon-upload" />
      <div class="el-upload__text">
        将文件拖到此处，或<em>点击上传</em>
      </div>
      <slot name="tip">
        只能上传jpg/png文件，且不超过500kb
      </slot>
    </el-upload>
  </div>
</template>

<script>
export default {
  props: {
    dragTag: {
      type: Boolean,
      default: false
    },
    multipleTag: {
      type: Boolean,
      default: false
    },
    fileList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
    }
  },
  methods: {
    handleChange(file, fileList) {
      console.log(file, fileList)
      // this.fileList.splice(0, this.fileList.length)
      // this.fileList.push(...fileList)
    }
  }
}
</script>

<style scoped>
.upload-main {
  padding: 5px;
  border: 1px dashed #ccc;
}
</style>
